<!DOCTYPE HTML>
<html>
<head>
    <title>Error</title>
    <link rel="stylesheet" href="/stylesheets/style.css">
    <script src="/scripts/jquery.min.js"></script>
    <link rel="stylesheet" href="/scripts/miniui/themes/default/miniui.css">
    <link rel="stylesheet" href="/scripts/miniui/themes/icons.css">
    <link rel="stylesheet" href="/scripts/miniui/themes/bootstrap/skin.css">
    <script src="/scripts/miniui/miniui.js"></script>
</head>
<body>
<span style="width:80px;display:inline-block;">店铺名称：</span>
<input id="name" class="mini-textbox" style="width:155px;" />

<span style="width:80px;display:inline-block;">店铺状态：</span>
<input id="status" class="mini-combobox" style="width:155px;" data="shopStatus" />
<br/><br/>

<span style="width:80px;display:inline-block;">展示方式：</span>
<input id="showType" class="mini-combobox" style="width:155px;" data="showTypeStatus" />

<span style="width:80px;display:inline-block;">店铺类型：</span>
<input id="type" class="mini-combobox" style="width:155px;" data="shopTypeStatus"  />

<br/><br/>

<span style="width:80px;display:inline-block;">店主：</span>
<input id="userId" class="mini-buttonedit" onbuttonclick="onButtonEdit" name="a" textName="b"/>
<br/><br/>

<span style="width:80px;display:inline-block;">审核理由：</span>
<textarea id="introduction" class="mini-textarea"  style="width: 400px;height: 100px"></textarea>

<br/><br/>
<div style="margin: 0 auto;text-align: center">
    <a class="mini-button " iconCls="icon-ok" onclick="updataShop()">确定</a>
    <a class="mini-button" iconCls="icon-cancel" onclick="onCancel">取消</a>
</div>
</body>
<script>
    var shopTypeStatus = JSON.parse('<%- result %>');
    var shopStatus = [{ id: 1, text: '正常' }, { id: 0, text: '关闭'}];
    var showTypeStatus = [{id: 1, text: '商品类型' },{id: 2, text: '热卖' }];
    function updataShop() {
        var name = mini.get("name").getValue();
        var showType = mini.get("showType").getValue();
        var introduction = mini.get("introduction").getValue();
        var status = mini.get("status").getValue();
        var type = mini.get("type").getValue();
        var userId = mini.get("userId").getValue();

        $.ajax({
            type: "POST",
            url: "/getdata/updataShopInformation",
            data: {
                name: name,
                showType: showType,
                introduction: introduction,
                status: status,
                type:type,
                userId:userId,
            },
            success: function (result) {
                CloseWindow("save");
            }
        })
    }
    //    关闭窗口
    function CloseWindow(action) {
        if (action == "close" && form.isChanged()) {
            if (confirm("数据被修改了，是否先保存？")) {
                return false;
            }
        }
        if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
        else window.close();
    }
    function onOk(e) {
        SaveData();
    }
    function onCancel(e) {
        CloseWindow("cancel");
    }
    function onButtonEdit(e) {
        var btnEdit = this;
        mini.open({
            url: "/tribeRoute/tribeMGEditSelectCreater",
            title: "选择列表",
            width: 700,
            height: 450,
            ondestroy: function (action) {
                //if (action == "close") return false;
                if (action == "ok") {
                    var iframe = this.getIFrameEl();
                    var data = iframe.contentWindow.GetData();
                    data = mini.clone(data);    //必须
                    if (data) {
                        btnEdit.setText(data.nickName);
                        btnEdit.setValue(data.objectId);
//                        grid.load({
//                            shopOId:data.id,
//                        });
                    }
                }

            }
        });

    }
</script>
</html>